// pages/base/base.js
Component({
  properties:{
    pageBackgroundColor:String,
    navBackgroundColor:String,
    pullStatus:{
      type:Boolean,
      value:false
    },
    pullRefresh:{
      type:Boolean,
      value:false
    }
  },
  /**
   * 页面的初始数据
   */
  data: {
    statusBarHeight:"",//状态栏高度,
    windowHeight:"",//屏幕可用高度
    minHeight:"",
    screenWidth:"",//设备宽度
    demo:"111999",
  },
  lifetimes:{
    // 在组件实例进入页面节点树时执行
    attached: function() {
      let _this = this;
      wx.getSystemInfo({
        success(res){
          _this.setData({
            statusBarHeight:res.statusBarHeight,
            windowHeight:res.windowHeight,
            screenWidth:res.screenWidth,
          })
          _this.pixelTransform();
        }
      })
    },
  },
  methods: {
    pixelTransform(){
      console.log(123);
      let minHeight =this.data.windowHeight - this.data.statusBarHeight - (80*this.data.screenWidth)/750;
      this.setData({
        minHeight:minHeight
      });
    },
    // 返回
    goBack(){
      this.triggerEvent('goBack')
    },
    refresherrefresh(){
      this.triggerEvent('pullRefresh')
    },
    scrolltolower(){
      console.log(this.data.pullRefresh);
      if(!this.data.pullRefresh){
        return;
      }
      this.triggerEvent('upRefresh')
    }
  },
})